package com.baizhi.enumeration3;

public enum Shape {

    //正方形
    SQUARE("正方形"),
    //长方形
    RECTANGLE("长方形"),
    //三角形
    TRIANGLE("三角形");

    private String shapeName; //图形名称
    private double width; //宽 ， 三角形底边
    private double height; //高

    Shape(String shapeName) {
        this.shapeName = shapeName;
    }

    public String getShapeName() {
        return shapeName;
    }

    public void setShapeName(String shapeName) {
        this.shapeName = shapeName;
    }

    public double getWidth() {
        return width;
    }

    public void setWidth(double width) {
        this.width = width;
    }

    public double getHeight() {

        return height;
    }

    public void setHeight(double height) {
        if("正方形".equals(shapeName)){
            this.height = this.width;
        }
        this.height = height;
    }


}
